package handler;

/**
*HandlerFactory er en singleton, som står for at oprette objekter af de andre Handlerklasser.
*/
public class HandlerFactory {

    private static HandlerFactory instance;
    
    private final AnsatHandler ansatHandler;
    private final LagerHandler lagerHandler;
    private final VareHandler vareHandler;
    
    private HandlerFactory(){
        this.ansatHandler = new AnsatHandler();
        this.lagerHandler = new LagerHandler();
        this.vareHandler = new VareHandler();
    }
    
    /**
    *Opretter ny factory, hvis objektet ikke findes
    */
    public static HandlerFactory getInstance(){
        if(instance == null){
            instance = new HandlerFactory();
        }
        return instance;
    }
    
    public AnsatHandler getAnsatHandler(){
        return ansatHandler;
    }
    
    public LagerHandler getLagerHandler(){
        return lagerHandler;
    }
    
    public VareHandler getVareHandler(){
        return vareHandler;
    }
}
